<%@page import="org.blog.beans.Entry"%>
<%@page import="org.blog.logic.BlogLogic"%>
<%@page import="org.blog.beans.Blog"%>
<%@page import="java.util.ArrayList"%>
<%@page import="org.blog.messages.UserSettingsMessage"%>
<%@page import="org.blog.controller.UserController"%>
<%@page import="org.blog.beans.User"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="ISO-8859-1" %>
<%@ page errorPage="../jsp/exceptionHandler.jsp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<jsp:include page="../jsp/cssChoose.jsp" />

<script type="text/javascript" src="js/validation.js"></script>

<title><%= request.getParameter("title") %></title>
</head>
<body>

 	<div id = "container"> 	
 	 	
 	<%Blog blog = (Blog)session.getAttribute("blog"); %> 	
 	 	
 	<jsp:include page="../jsp/header.jsp">
 		<jsp:param value="<%= blog.getName() %>" name="title"/>
 	</jsp:include>
 	
 	 	 		<div id="texts">
	<jsp:include page="../jsp/menu.jsp"/>	
		
		<div id = "content">
		
			<h1><%= blog.getName() %></h1>	
			<%= blog.getDescription() %>

				
			<%
			int i = 0;
			for(Entry e : blog.getEntries()) { %>		
				<div class = entry><a href = "EntryServlet?do=entry&id=<%= e.getId()%>">
				<%=++i +". "+ e.getTitle()+"("+e.getComments().size()+")" %></a></div>
			<%} %>
			
			<%if(UserController.isLogged(session))
				if(blog.getUserId() == UserController.getUser(session).getId()) { 
									
			%>
				<a href = "EntryServlet?do=add">dodaj wpis</a><br/>								
				<%} %>
		</div>
		
	</div>
		<jsp:include page="../html/footer.html"/>
						

	</div>
	
</body>
</html>